//utf-8
function buy(){
	var table=iframe.iframeObj["table"],
		ids = table.getSelectedIds(),
		dataMap=table.dataMap;
	var obj = {
		"text" : '新建债权购买',
		"url" : contextRootPath + '/creditBuy/prepareExecute/toAdd'
	};
	parent.showObj(obj);
}

//点击新增按钮 事件跳转至 新增页面
function toAddData(type) {

	var obj = {
		"text" : '新建债权购买',
		"url" : contextRootPath + '/creditBuy/prepareExecute/toAdd'
	};
	parent.showObj(obj);
}

//查看明细
function viewData(vId) {
	var dealCode = iframe.iframeObj["table"].dataMap[vId].dealCode;
	var cooperorgCode = iframe.iframeObj["table"].dataMap[vId].cooperorgCode;
	var creditPackageName = iframe.iframeObj["table"].dataMap[vId].creditPackageName;
	var contractCode = iframe.iframeObj["table"].dataMap[vId].contractCode;
	
	var obj = {
		"text" : '查看二次购买信息',
		"url" : contextRootPath + '/settle/prepareExecute/toView?dealCode=' + dealCode + '&isCreditBuy=true' + '&contractCode=' + contractCode + "&creditPackageName=" + creditPackageName + "&cooperorgCode=" + cooperorgCode
	};
	parent.showObj(obj);
}

//修改 事件
function toUpdateData(){
	var v_ids = iframe.iframeObj["table"].getSelectedIds().join(",");
	//如果没有选中 数据则
	if(v_ids == ""){
		alert("请选择待修改的数据！");
		return;
	}
	//如果选择多个 择提示
	if(v_ids.indexOf(",") > -1){
		alert("请选择一条数据！");
		return;
	}
	var cooperorgCode = iframe.iframeObj["table"].getSelectedObjs("cooperorgCode");
	var creditPackageName = iframe.iframeObj["table"].getSelectedObjs("creditPackageName");
	var contractCode = iframe.iframeObj["table"].getSelectedObjs("contractCode");
	var dealCode = iframe.iframeObj["table"].getSelectedObjs("dealCode");
	var obj={"text":'修改债权购买交易',"url":contextRootPath+'/creditBuy/prepareExecute/toUpdate?contractCode=' + contractCode + "&creditPackageName=" + creditPackageName + "&cooperorgCode=" + cooperorgCode + "&dealCode=" + dealCode +"&id=" +v_ids};
	parent.showObj(obj);
}
